var app = getApp();
var phone;
Page({
  data: {
    winHeight: "",//窗口高度
    currentTab: 0, //预设当前项的值
    scrollLeft: 0, //tab标题的滚动条位置
    modalHidden2: true,
    expertList: [{ //假数据
      img: "avatar.png",
      name: "欢顔",
      tag: "知名情感博主",
      answer: 134,
      listen: 2234
    }],
    acorres:[{
      status:0,
      number:"201845646456",
      condit:"待支付",
      receive:"淮海文化产业园A座20号1楼创客邦淮海文化产业淮海文化产业淮海文化产业淮海文化产业",
      getit:"淮海文化产业园A座20号1楼创客邦淮海文化产业淮海文化产业淮海文化产业淮海文化产业",
      goods:"文件",
      weight:"0.8kg",
      time:"立即取件",
      toal:"200",
      express:"6.00",
      added:"0.00",
      remarks:"请慢点轻拿轻放，谢谢！",
      date:"2018.02.14  12:00",
      pay:"去支付",
      cancel:"取消订单",
      tel:"联系骑手"

    }, {
      status: 1,
      number: "201845646457",
      condit: "待取件",
      receive: "淮海文化产业园A座20号1楼创客邦淮海文化产业淮海文化产业淮海文化产业淮海文化产业",
      getit: "淮海文化产业园A座20号1楼创客邦淮海文化产业淮海文化产业淮海文化产业淮海文化产业",
      goods: "文件",
      weight: "0.8kg",
      time: "立即取件",
      toal: "200",
      express: "6.00",
      added: "0.00",
      remarks: "请慢点轻拿轻放，谢谢！",
      date: "2018.02.14  14:00",
      pay: "去支付",
      cancel: "取消订单",
      tel: "联系骑手"

      },{
        status: 2,
        number: "201845646458",
        condit: "待送达",
        receive: "淮海文化产业园A座20号1楼创客邦淮海文化产业淮海文化产业淮海文化产业淮海文化产业",
        getit: "淮海文化产业园A座20号1楼创客邦淮海文化产业淮海文化产业淮海文化产业淮海文化产业",
        goods: "文件",
        weight: "0.8kg",
        time: "立即取件",
        toal: "200",
        express: "6.00",
        added: "0.00",
        remarks: "请慢点轻拿轻放，谢谢！",
        date: "2018.02.14  15:00",
        pay: "去支付",
        cancel: "取消订单",
        tel: "联系骑手"

      }],
    phone:[{
      number:'15152186227'
    }]
  },
  // 滚动切换标签样式
  switchTab: function (e) {
    this.setData({
      currentTab: e.detail.current
    });
    this.checkCor();
  },
  // 点击标题切换当前页时改变样式
  swichNav: function (e) {
    var cur = e.target.dataset.current;
    if (this.data.currentTaB == cur) { return false; }
    else {
      this.setData({
        currentTab: cur
      })
    }
  },
  // 待取件
  noTitlemodalTap: function (e) {
    wx.showModal({
      content: "如果现在取消订单则需要赔付违约金您确定要取消嘛",
      confirmText: "确定",
      cancelText: "取消",
      success:function(res){
        if(res.confirm){
          console.log("确定取消，调用接口")
          // wx.request({
          //   url: '',
          // })
        }else if(res.cancel){
           console.log("用户取消");
        }
      }
    })
  },
//去支付
gotopay:function(){

},

  // 打电话
  makePhoneCall:function(){
    // console.log(phone.number)
    wx.makePhoneCall({
      phoneNumber: '12345678900', //此号码并非真实电话号码，仅用于测试  
      success: function () {
        console.log("拨打电话成功！")
      },
      fail: function () {
        console.log("拨打电话失败！")
      }
    })
    
  },
  //判断当前滚动超过一屏时，设置tab标题滚动条。
  checkCor: function () {
    if (this.data.currentTab > 4) {
      this.setData({
        scrollLeft: 300
      })
    } else {
      this.setData({
        scrollLeft: 0
      })
    }
  },
  onLoad: function (options) {
    var that = this;
    var tips = options.tips;
    this.setData({
      currentTab: parseInt(options.tips),
      //isStatus: options.otype
    });
    //  高度自适应
    wx.getSystemInfo({
      success: function (res) {
        var clientHeight = res.windowHeight,
          clientWidth = res.windowWidth,
          rpxR = 750 / clientWidth;
        var calc = clientHeight * rpxR - 180;
        console.log(calc)
        that.setData({
          winHeight: calc
        });
      }
    });
  },
  footerTap: app.footerTap
})